package com.amado.course34Thread;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;

public class S12UncaughtExceptionHandler {
    static Logger logger = Logger.getLogger("a");
    public static void main(String[] args) {
        Thread do_some = new Thread(() -> {
            logger.info("do some");
            try {
                System.out.println(1 / 0);
            } catch (Exception e) {
                logger.info(e.getMessage());
                e.printStackTrace();
                throw e;
            }
        });
        //此方法为异常时JVM调用的
        do_some.setUncaughtExceptionHandler((t,e)->{
            logger.info("setUncaughtExceptionHandler "+e.getMessage());
        });
        do_some.start();
    }

}
